package main

import (
	"fileServer/router"
	"fileServer/setting"
	"flag"
)

func main() {
	var dirPath string
	var rootURL string
	var host string
	var port int

	flag.StringVar(&dirPath, "d", ".", "文件服务 起始路径，默认当前目录")
	flag.StringVar(&rootURL, "u", "/file", "文件服务URL，默认 /file")
	flag.StringVar(&host, "h", "localhost", "文件服务监听地址，默认localhost")
	flag.IntVar(&port, "p", 80, "文件服务监听地址，默认80")
	//解析命令行参数，写入注册的flag里面
	flag.Parse()
	setting.SetSetting(dirPath, rootURL, host, port)
	// 启动服务
	router.Run()
}
